/*
 * @Author: Shane
 * @Date: 2022-05-31 13:32:58
 * @LastEditTime: 2023-10-20 14:53:44
 * @LastEditors: KaKa
 * @Description: 
 * @FilePath: /kkhttp/lib/kk_http_cfg.dart
 */

/// Callback to listen the progress for sending/receiving data.
///
/// [count] is the length of the bytes have been sent/received.
///
/// [total] is the content length of the response/request body.
/// 1.When receiving data:
///   [total] is the request body length.
/// 2.When receiving data:
///   [total] will be -1 if the size of the response body is not known in advance,
///   for example: response data is compressed with gzip or no content-length header.
typedef KKProgressCallback = void Function(int count, int total);

enum KKHttpLogLevel {
  release,
  debug,
  normal,
  detail,
}

class KKHttpCfg {
  /// 服务API地址
  final String? baseUrl;

  ///
  final String? contentType;

  /// 代理地址
  final String? proxy;

  //// 连接超时时间
  final Duration connectTimeout;

  /// 发送超时时间
  final Duration sendTimeout;

  /// 接收超时时间
  final Duration receiveTimeout;

  KKHttpCfg({
    this.baseUrl,
    this.proxy,
    this.contentType = 'application/json',
    this.connectTimeout = const Duration(seconds: 5),
    this.sendTimeout = const Duration(seconds: 5),
    this.receiveTimeout = const Duration(seconds: 3),
  });
}
